The
Treebrowser
|
Topics
The Treebrowser applet is an applet displaying a Windows Explorer looking
structure. For an example please see.
Below there are instructions how to configure the applet.
First the parameters in the applet tag are described and
then the dat-file defining the tree structure is described. |
Name |
Example |
Description |
archive
(optional) |
treebrowse.zip |
To speed up the loading of the applet there are
a file named treebrowse.zip. |
wwwroot
(optional) |
treebrowse |
Defines where the dat-file and the pictures have
their top directory. If this parameter is not defined wwwroot is set to the
document base of the HTML document containing the applet tag. In most cases
this parameter is not used. |
datafile
(optional) |
tree.zip |
The name of the dat-file defining the structure
of the tree.
The default value is "tree.dat".
To speed up the loading of the applet, the dat-file can be compressed into a
zip-file. The parameter value is then the name of the zip-file. Notice that
the dat-file must be named "tree.dat" in this case. |
delimeters
(optional) |
* |
This parameter defines the separating character
in the datafile. Each part of the data file is separated by this character.
This parameter is useful when RUP is deployed on a operation system not
supporting the "*" sign. The default value is "*". |
characterset
(optional) |
SJIS |
This parameter needs only to be defined if the
datafile is not stored in a format that is the default format for the
current operating system. |
|
For all parameters related to colors, the values and syntax,
click here. |
bgcolor
(optional) |
white |
Defines the background color of the Treebrowser.
The default value is white. |
bgimage
(optional) |
bg.gif |
The name of the image that shall be displayed as
a background of the Treebrowser. If this parameter is missing the background
is set to the value of the parameter "bgcolor". |
fgcolor
(optional) |
black |
The color of the node labels. The default value
is black. |
selbgcolor
(optional) |
0,0,255 |
The color of the rectangular are that surrounds
the label text of the currently selected node. The default value is 0,0,255. |
selfgcolor
(optional) |
white |
The color of the text for the selected node. The
default value is white. |
visitcolor
(optional) |
255,51,51 |
The color of the text for the nodes whose html
documents you have already read. The default value is 255,51,51. |
visitoncemarkall
(optional) |
true |
If there are more than one node in the tree with
the same URL this parameter specifies if all these nodes shall be marked
visited as soon as one of them are visited. The default value is false. |
mouseovercolor
(optional) |
blue |
The color of the text of the node the mouse is
currently over. Only valid if the node has a related document. The default
value is blue. |
mouseovershadow
(optional) |
true |
Specifies if the node that the mouse is
currently over shall show a tree-dimensional shadow of the node text. The
default value is true. |
target
(optional) |
_top |
The name of the HTML frame where the documents
shall be shown if the dat-file does not specify any target for the node. The
default value is _top. |
scrollbartoleft
(optional) |
false |
Specifies if the horizontal scrollbar shall be
to the left of the tree or not. The default value is false,
i.e. it is to the right of the tree. |
verticalincrement
(optional) |
1 |
The number of nodes that shall be moved up or
down when you click on the vertical scrollbar. The default value is 1.
If the tree has very many nodes it can be a good idea to use this parameter
to get the Treebrowser behave in a nice way. |
horizontalincrement
(optional) |
1 |
The number of positions the tree shall be moved
sidewise when the horizontal scrollbar is clicked. The default value is 1.
|
gc
(optional) |
10 |
In java the memory allocation and de-allocation
shall be handled automatically the runtime environment. This is however not
done properly. This will cause the Treebrowser to consume to much memory.
With this parameter you can specify how often the garbage collector shall be
called. The number specifies how many times the tree shall be redrawn before
the garbage collector is called. The default value is 10.
|
maxvisiblenodes
(optional) |
100 |
If you use the public method selectNode the tree
may be automatically expanded. This may result in that very many nodes are
visible. This parameter defines the maximum number of visible nodes. The
default value is 100.
|
cellsize
(optional) |
16 |
The height in pixels each node in the tree
occupies. The default value is 16. This is
also the size of the pictures that can be used for each node. If the
cellsize is set to 24 the maxsize of the picture is 24 x 24 pixels. The
value has to be even. |
|
Click here for details
regarding the syntax and value of all parameters regarding fonts. |
treefont
(optional) |
Arial,PLAIN,12 |
Specifies the font of the node labels in the
tree. The default value is Arial,PLAIN,12. |
border
(optional) |
false |
Specifies if the tree shall be surrounded by a
border. This parameter is only applicable if the tree is shown directly in
the applet area. The default value is false. |
frame
(optional) |
false |
Specifies if the tree shall be shown in an own
window or in the applet area. If the tree is show in the applet area the
following parameters are not applicable. If the tree is shown in an own
window the size of the applet area can be made smaller. The default value is
false. |
framewidth
(optional) |
250 |
Specifies the width of the separate window. The
default value is 250. |
frameheight
(optional) |
400 |
Specifies the height of the separate window. The
default value is 400. |
frametitle
(optional) |
Tree Browser |
Specifies the title of the separate window. The
default value is Tree Browser. |
frameimage
(optional) |
images/icon.gif |
When the tree is shown in a separate window you
can choose to display a text, a image or both in the applet area. Specify
the image relative to the wwwroot or documentbase, for example "images/icon.gif".
If the image can not be loaded the text specified by the parameter
framelabel will be shown. |
framelabel
(optional) |
Tree Browser |
Specify the text to be shown in the applet area
when the tree is shown in a separate window. The default value is Tree
Browser. |
labelpos
(optional) |
below |
If both the parameters frameimage and framelabel
are specified this parameter specifies where the text shall be written
according to the image. Possible values are "right" and
"below". The default value is below. |
framelabelfont
(optional) |
Arial,BOLD,12 |
Specifies the font of the text specified by the
parameter framelabel. The default value is Arial,BOLD,12. |
framelabelbgcolor
(optional) |
white |
Specifies the background color of the applet are
when the tree is shown in a separate window. The default value is white. |
The data file
Notice that the data-file can be compressed into a
zip-file, to speed up the loading of the applet. See the applet parameter 'datafile',
for more information.
|
images*
0*First node*index.html*Left*BookClosed.gif*BookOpen.gif*false* |
images* |
|
The first row in the dat-file specifies the name
of the directory where the images are located. The directory can be
specified in three ways, relative the dat-file, as a complete URL or as an
URL that begins with "/". The last alternative is to be used when
to access the applet through a file-server, for example '/C:/Work/index.htm'.
The Treebrowser will make up to four tries to
find the specified pictures.
First of all it will search the directory
specified in the dat-file
The second alternative is to search the
directory images below the dat-file.
The third alternative is to search the directory
specified in the dat-file of a parent tree.
Finally it will search the directory images
below the parent trees dat-file. |
Each node in the tree specifies by one row in the dat-file.
Each row consists of seven parts. Each part ends with a "*". This
results in that the "*" character can not be used for anything
else in the dat-file. The dat-file is not sensitive for space characters in
the beginning and end of each part. They will be stripped by the program. |
0* |
|
Specifies the level in the tree the node
belongs. The first node has always the lowest value of this part. The child
of a node have 1 level higher than its parent. If several nodes have the
lowest value they will be siblings. No node is however allowed to have a
lower value than the first one. |
First node* |
|
The label of the first node. This text is the
one that will be visible in the tree. |
index.html* |
|
The URL of the file that shall be opened when
you click on the node. If no file is connected to the node specify one or
more space characters in this position. The URL can be an complete URL, for
example http://www.rational.com. It can be relative the dat-file, for
example ../index.htm. An URL that is relative is always relative the
directory where the dat-file is located.
If the URL begins with "/" then an URL
that begins with the parts of the documentbase that is protocol, host and
port followed by the text in the dat-file will be created. For example if
the document root of the applet page is
"http://www.ruptools.com:1100/applet/treebrowse.htm" then
"http://www.ruptools.com:1100" will be put before the text in the
dat-file.
If you want to include another dat-file into
your tree you specify a node as the only child of the parent node to the
subtree. This dummy node will be replaced with the root node of the subtree.
The URL to the dat-file is specified as the URL in the dummy node. The new
dat-file have to have the suffix ".dat". The subtree is created
when you click on its parent node and not at start up of the Treebrowser. |
Left* |
|
The name of the Target/Frame in which this
document is to be shown. The standard HTML target such as "_top"
does work. If you want this document to be shown in the Target/Frame
specified by the parameter "target" type one or more space
characters here. |
BookClosed.gif* |
|
This is the name of the image displayed when the
node is closed. The image shall be of the size 16 x 16 pixels as long as you
have not specified any other value of the parameter "cellsize" If
the node do not have any image specify one or more space characters. |
BookOpen.gif* |
|
This is the name of the image displayed when the
node is open. If the node do not have any image specify one or more space
characters. |
true* |
|
Specifies if the node shall be expanded or not
when the tree is initially loaded. If the value is "true" the node
will be expanded if it has some children. Every other value will make the
node collapsed at startup. If the node does not have any child nodes or if
the child node is a new dat-file this part is not of any importance. |
Programming interface
|
Methodname |
Returns |
Description |
isReady |
Boolean |
Return true if the Treebrowser is completely
loaded, false if not. Until the Treebrowser is completely loaded the other
methods are not able to proceed its services. |
getParentUrl(String url) |
String |
This method takes the url of a node in the tree
and returns the url of the parent node. If the url is not found in any node
or if the node does not have any parent null is returned. For all the
following methods the Treebrowser will start searching from the top node and
down. If there are more than one node with the same url only the first one
will be found. |
getParentLabel(String url) |
String |
This method takes the url of a node in the tree
and returns the label of the parent node. If the url is not found in any
node or if the node does not have any parent null is returned. |
getChildUrl(String url) |
String |
This method takes the url of a node in the tree
and returns the url of the first child node. If the url is not found in any
node or if the node does not have any child null is returned. |
getChildLabel(String url) |
String |
This method takes the url of a node in the tree
and returns the label of the first child node. If the url is not found in
any node or if the node does not have any child null is returned. |
getPreviousUrl(String url) |
String |
This method takes the url of a node in the tree
and returns the url of the previous sibling node. If the url is not found in
any node or if the node does not have any previous sibling null is returned. |
getPreviousLabel(String url) |
String |
This method takes the url of a node in the tree
and returns the label of the previous sibling node. If the url is not found
in any node or if the node does not have any previous sibling null is
returned. |
getNextUrl(String url) |
String |
This method takes the url of a node in the tree
and returns the url of the next sibling node. If the url is not found in any
node or if the node does not have any next sibling null is returned. |
getNextLabel(String url) |
String |
This method takes the url of a node in the tree
and returns the label of the next sibling node. If the url is not found in
any node or if the node does not have any next sibling null is returned. |
selectNode(String url) |
void |
This method takes the url of a node in the tree
and sets that node to be the selected one. If the node is not visible it
will become visible. The tree may be collapsed if to many nodes are visible.
The vertical scrollbar may also be affected. |